package com.xbongbong.paas.pojo.workflow;

import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.workflow.pojo.WorkflowOperationsPojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author 吴峰
 * @date 2021/06/23 9:58
 */
@Getter
@Setter
@ToString
public class WorkflowExplainPojo implements Serializable {
    private static final long serialVersionUID = 4583467910044230861L;

    /**
     * 获取节点id
     */
    private Set<Long> workflowNodeList;
    /**
     * 数据源子表单内字段容器
     * 数据来源：触发节点，获取多条数据节点，获取单条数据节点
     * {表单id: {"子表单attr" : {"子表单内字段的attr" : 字段的属性}}}
     * {表单id: {"subForm_1" : {"text_1" : {"attr": "text_1", "fieldType": 1}}}}
     */
    private Map<Long, Map<String, Map<String, FieldAttrEntity>>> subExplainMap;
    /**
     * 数据源工单子表单内字段容器
     * 数据来源：触发节点，获取多条数据节点，获取单条数据节点
     * {工单表单id: {"子表单attr" : {"子表单内字段的attr" : 字段的属性}}}
     * {工单表单id: {"subForm_1" : {"text_1" : {"attr": "text_1", "fieldType": 1}}}}
     */
    private Map<Long, Map<String, Map<String, FieldAttrEntity>>> workOrderSubExplainMap;


    /**
     * 新建数据节点：赋值给主字段
     */
    private Map<String, WorkflowOperationsPojo> operatorMap;
    /**
     * 需要更新的字段，即目标表单字段
     */
    private Map<String, FieldAttrEntity> targetExplainMap;

    /**
     * 数据源的字段：
     * 数据来源：触发节点，获取多条数据节点，获取单条数据节点
     * 工单的key为：workOrder_表单id
     * 非工单的key为：表单id
     */
    private Map<String, Map<String, FieldAttrEntity>> thisExplainMap;
    /**
     * 新建数据节点：赋值给子表单内字段，可能有多个子表单字段
     */
    private Map<String, Map<String, WorkflowOperationsPojo>> targetSubOperator;
    /**
     * 更新数据节点：赋值给子表单内字段
     */
    List<WorkflowOperationsPojo> subOperationList;
    /**
     * 更新数据节点：赋值给主字段
     */
    List<WorkflowOperationsPojo> mainOperationList;

    public WorkflowExplainPojo(Map<Long, Map<String, Map<String, FieldAttrEntity>>> subExplainMap,
                               Map<Long, Map<String, Map<String, FieldAttrEntity>>> workOrderSubExplainMap,
                               Map<String, Map<String, WorkflowOperationsPojo>> targetSubOperator,
                               Map<String, WorkflowOperationsPojo> operatorMap, Map<String, FieldAttrEntity> targetExplainMap,Map<String, Map<String, FieldAttrEntity>> thisExplainMap, Set<Long> workflowNodeList){
        this.subExplainMap = subExplainMap;
        this.workOrderSubExplainMap = workOrderSubExplainMap;
        this.targetSubOperator = targetSubOperator;
        this.operatorMap = operatorMap;
        this.targetExplainMap = targetExplainMap;
        this.thisExplainMap = thisExplainMap;
        this.workflowNodeList = workflowNodeList;
    }
}
